using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._SpatialStatisticsTools._MeasuringGeographicDistributions
{
    /// <summary>
    /// <para>Neighborhood Summary Statistics</para>
    /// <para>Calculates summary  statistics of one or more numeric fields using local neighborhoods around each feature.  The local statistics include mean (average), median, standard deviation, interquartile range, skewness, and quantile imbalance, and all statistics can be geographically weighted using kernels to give more influence to neighbors closer to the focal feature.  Various neighborhood types can be used, including distance band, number of neighbors, polygon contiguity, Delaunay triangulation, and spatial weights matrix (.swm) files.
    /// Summary statistics are also calculated for the distances to the neighbors of each feature.</para>
    /// <para>使用每个要素周围的局部邻域计算一个或多个数值字段的汇总统计量。 局部统计量包括均值（平均值）、中位数、标准差、四分位距、偏度和分位数不平衡，并且所有统计量都可以使用内核进行地理加权，以便对更接近焦点要素的邻居产生更大的影响。 可以使用各种邻域类型，包括距离带、邻域数、多边形连续性、Delaunay 三角测量和空间权重矩阵 （.swm） 文件。
    /// 此外，还会针对每个要素的邻域距离进行汇总统计。</para>
    /// </summary>    
    [DisplayName("Neighborhood Summary Statistics")]
    public class NeighborhoodSummaryStatistics : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public NeighborhoodSummaryStatistics()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_features">
        /// <para>Input Features</para>
        /// <para>The point or polygon features that will be used to calculate the local statistics.</para>
        /// <para>将用于计算局部统计数据的点要素或面要素。</para>
        /// </param>
        /// <param name="_output_features">
        /// <para>Output Features</para>
        /// <para>The output feature class containing the local statistics as fields. Each statistic of each analysis field will be stored as an individual field.</para>
        /// <para>包含以字段形式显示的本地统计数据的输出要素类。每个分析字段的每个统计数据都将存储为单个字段。</para>
        /// </param>
        public NeighborhoodSummaryStatistics(object _in_features, object _output_features)
        {
            this._in_features = _in_features;
            this._output_features = _output_features;
        }
        public override string ToolboxName => "Spatial Statistics Tools";

        public override string ToolName => "Neighborhood Summary Statistics";

        public override string CallName => "stats.NeighborhoodSummaryStatistics";

        public override List<string> AcceptEnvironments => ["outputCoordinateSystem"];

        public override object[] ParameterInfo => [_in_features, _output_features, _analysis_fields, _local_summary_statistic.GetGPValue(), _include_focal_feature.GetGPValue(), _ignore_nulls.GetGPValue(), _neighborhood_type.GetGPValue(), _distance_band, _number_of_neighbors, _weights_matrix_file, _local_weighting_scheme.GetGPValue(), _kernel_bandwidth];

        /// <summary>
        /// <para>Input Features</para>
        /// <para>The point or polygon features that will be used to calculate the local statistics.</para>
        /// <para>将用于计算局部统计数据的点要素或面要素。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Features")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_features { get; set; }


        /// <summary>
        /// <para>Output Features</para>
        /// <para>The output feature class containing the local statistics as fields. Each statistic of each analysis field will be stored as an individual field.</para>
        /// <para>包含以字段形式显示的本地统计数据的输出要素类。每个分析字段的每个统计数据都将存储为单个字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Features")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _output_features { get; set; }


        /// <summary>
        /// <para>Analysis Fields</para>
        /// <para>One or more fields for which local statistics will be calculated. If no analysis fields are provided, only local statistics based on distances to neighbors will be calculated.</para>
        /// <para>将计算其本地统计信息的一个或多个字段。如果未提供分析字段，则仅计算基于与邻居距离的本地统计数据。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Analysis Fields")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public List<object> _analysis_fields { get; set; } = null;


        /// <summary>
        /// <para>Local Summary Statistic</para>
        /// <para><xdoc>
        ///   <para>Specifies the local summary statistic that will be calculated for each analysis field.</para>
        ///   <bulletList>
        ///     <bullet_item>All—All local statistics will be calculated. This is the default.</bullet_item><para/>
        ///     <bullet_item>Mean—The local mean (average) will be calculated.</bullet_item><para/>
        ///     <bullet_item>Median— The local median will be calculated.</bullet_item><para/>
        ///     <bullet_item>Standard deviation—The local standard deviation will be calculated.</bullet_item><para/>
        ///     <bullet_item>Interquartile range— The local interquartile range will be calculated.</bullet_item><para/>
        ///     <bullet_item>Skewness— The local skewness will be calculated.</bullet_item><para/>
        ///     <bullet_item>Quantile imbalance— The local quantile imbalance will be calculated.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定将为每个分析字段计算的局部汇总统计数据。</para>
        ///   <bulletList>
        ///     <bullet_item>全部—将计算所有本地统计数据。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>均值—将计算局部均值（平均值）。</bullet_item><para/>
        ///     <bullet_item>中位数— 将计算本地中位数。</bullet_item><para/>
        ///     <bullet_item>标准差—将计算局部标准差。</bullet_item><para/>
        ///     <bullet_item>四分位距— 将计算局部四分位距。</bullet_item><para/>
        ///     <bullet_item>偏度 - 将计算局部偏度。</bullet_item><para/>
        ///     <bullet_item>分位数不平衡— 将计算局部分位数不平衡。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Local Summary Statistic")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _local_summary_statistic_value _local_summary_statistic { get; set; } = _local_summary_statistic_value._ALL;

        public enum _local_summary_statistic_value
        {
            /// <summary>
            /// <para>All</para>
            /// <para>All—All local statistics will be calculated. This is the default.</para>
            /// <para>全部—将计算所有本地统计数据。这是默认设置。</para>
            /// </summary>
            [Description("All")]
            [GPEnumValue("ALL")]
            _ALL,

            /// <summary>
            /// <para>Mean</para>
            /// <para>Mean—The local mean (average) will be calculated.</para>
            /// <para>均值—将计算局部均值（平均值）。</para>
            /// </summary>
            [Description("Mean")]
            [GPEnumValue("MEAN")]
            _MEAN,

            /// <summary>
            /// <para>Median</para>
            /// <para>Median— The local median will be calculated.</para>
            /// <para>中位数— 将计算本地中位数。</para>
            /// </summary>
            [Description("Median")]
            [GPEnumValue("MEDIAN")]
            _MEDIAN,

            /// <summary>
            /// <para>Standard deviation</para>
            /// <para>Standard deviation—The local standard deviation will be calculated.</para>
            /// <para>标准差—将计算局部标准差。</para>
            /// </summary>
            [Description("Standard deviation")]
            [GPEnumValue("STD_DEV")]
            _STD_DEV,

            /// <summary>
            /// <para>Interquartile range</para>
            /// <para>Interquartile range— The local interquartile range will be calculated.</para>
            /// <para>四分位距— 将计算局部四分位距。</para>
            /// </summary>
            [Description("Interquartile range")]
            [GPEnumValue("IQR")]
            _IQR,

            /// <summary>
            /// <para>Skewness</para>
            /// <para>Skewness— The local skewness will be calculated.</para>
            /// <para>偏度 - 将计算局部偏度。</para>
            /// </summary>
            [Description("Skewness")]
            [GPEnumValue("SKEWNESS")]
            _SKEWNESS,

            /// <summary>
            /// <para>Quantile imbalance</para>
            /// <para>Quantile imbalance— The local quantile imbalance will be calculated.</para>
            /// <para>分位数不平衡— 将计算局部分位数不平衡。</para>
            /// </summary>
            [Description("Quantile imbalance")]
            [GPEnumValue("QUANTILE_IMBALANCE")]
            _QUANTILE_IMBALANCE,

        }

        /// <summary>
        /// <para>Include Focal Feature in Calculations</para>
        /// <para><xdoc>
        ///   <para>Specifies whether the focal feature will be included when calculating local statistics for each feature.
        ///   <bulletList>
        ///     <bullet_item>Checked—The focal feature and all of its neighbors will be included when calculating local statistics. This is the default.  </bullet_item><para/>
        ///     <bullet_item>Unchecked—The focal feature will not be included when calculating local statistics. Only neighbors of the feature will be included.  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        /// <para>指定在计算每个要素的局部统计数据时是否包括焦点要素。
        ///   <bulletList>
        ///     <bullet_item>选中 - 计算局部统计数据时，将包括焦点要素及其所有相邻要素。这是默认设置。 </bullet_item><para/>
        ///     <bullet_item>未选中 - 计算局部统计数据时将不包括焦点要素。仅包括要素的邻居。 </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Include Focal Feature in Calculations")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _include_focal_feature_value _include_focal_feature { get; set; } = _include_focal_feature_value._true;

        public enum _include_focal_feature_value
        {
            /// <summary>
            /// <para>INCLUDE_FOCAL</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("INCLUDE_FOCAL")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>EXCLUDE_FOCAL</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("EXCLUDE_FOCAL")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Ignore Null Values in Calculations</para>
        /// <para><xdoc>
        ///   <para>Specifies whether null values in the analysis fields will be included or ignored in the calculations.</para>
        ///   <para>
        ///     <bulletList>
        ///       <bullet_item>Checked—Null values in the analysis fields will be ignored, and statistics will be calculated using only non-null values. This is the default.</bullet_item><para/>
        ///       <bullet_item>Unchecked—Null values in the analysis fields will be included in the calculations, and any local statistic will be calculated as null if any of the values used in the calculation are null.</bullet_item><para/>
        ///     </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定在计算中是包括还是忽略分析字段中的空值。</para>
        ///   <para>
        ///     <bulletList>
        ///       <bullet_item>选中 - 将忽略分析字段中的空值，并且将仅使用非空值计算统计数据。这是默认设置。</bullet_item><para/>
        ///       <bullet_item>未选中 - 分析字段中的空值将包含在计算中，如果计算中使用的任何值为空，则任何局部统计数据都将计算为空值。</bullet_item><para/>
        ///     </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Ignore Null Values in Calculations")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _ignore_nulls_value _ignore_nulls { get; set; } = _ignore_nulls_value._true;

        public enum _ignore_nulls_value
        {
            /// <summary>
            /// <para>IGNORE_NULLS</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("IGNORE_NULLS")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>INCLUDE_NULLS</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("INCLUDE_NULLS")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Neighborhood Type</para>
        /// <para><xdoc>
        ///   <para>Specifies how neighbors will be chosen for each input feature. To calculate local statistics, neighboring features must be identified for each input feature, and these neighbors are used to calculate the local statistics for each feature. For point features, the default is Delaunay triangulation. For polygon features, the default is Contiguity edges corners.</para>
        ///   <bulletList>
        ///     <bullet_item>Distance band—Features within a specified critical distance of each feature will be included as neighbors.</bullet_item><para/>
        ///     <bullet_item>Number of neighbors— The closest features will be included as neighbors.</bullet_item><para/>
        ///     <bullet_item>Contiguity edges only— Polygon features that share an edge will be included as neighbors.</bullet_item><para/>
        ///     <bullet_item>Contiguity edges corners— Polygon features that share an edge or a corner will be included as neighbors. This is the default for polygon features.</bullet_item><para/>
        ///     <bullet_item>Delaunay triangulation—Features whose Delaunay triangulation share an edge will be included as neighbors. This is the default for point features.</bullet_item><para/>
        ///     <bullet_item>Get spatial weights from file— Neighbors and weights will be defined by a specified spatial weights file.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定如何为每个输入要素选择相邻要素。要计算局部统计数据，必须为每个输入要素标识相邻要素，并使用这些相邻要素来计算每个要素的局部统计数据。对于点要素，默认值为 Delaunay 三角剖分。对于面要素，默认值为连续性边角。</para>
        ///   <bulletList>
        ///     <bullet_item>距离带—每个要素的指定临界距离内的要素将作为邻域包括在内。</bullet_item><para/>
        ///     <bullet_item>相邻要素数—最近要素将作为相邻要素包括在内。</bullet_item><para/>
        ///     <bullet_item>仅限毗连性边—共享边的面要素将作为邻居包括在内。</bullet_item><para/>
        ///     <bullet_item>连续边角 - 共享边或角的面要素将作为邻居包括在内。这是面要素的默认设置。</bullet_item><para/>
        ///     <bullet_item>Delaunay 三角剖分—Delaunay 三角剖分共享边的要素将作为相邻要素包括在内。这是点要素的默认设置。</bullet_item><para/>
        ///     <bullet_item>从文件中获取空间权重 - 相邻项和权重将由指定的空间权重文件定义。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Neighborhood Type")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _neighborhood_type_value? _neighborhood_type { get; set; } = null;

        public enum _neighborhood_type_value
        {
            /// <summary>
            /// <para>Distance band</para>
            /// <para>Distance band—Features within a specified critical distance of each feature will be included as neighbors.</para>
            /// <para>距离带—每个要素的指定临界距离内的要素将作为邻域包括在内。</para>
            /// </summary>
            [Description("Distance band")]
            [GPEnumValue("DISTANCE_BAND")]
            _DISTANCE_BAND,

            /// <summary>
            /// <para>Number of neighbors</para>
            /// <para>Number of neighbors— The closest features will be included as neighbors.</para>
            /// <para>相邻要素数—最近要素将作为相邻要素包括在内。</para>
            /// </summary>
            [Description("Number of neighbors")]
            [GPEnumValue("NUMBER_OF_NEIGHBORS")]
            _NUMBER_OF_NEIGHBORS,

            /// <summary>
            /// <para>Contiguity edges only</para>
            /// <para>Contiguity edges only— Polygon features that share an edge will be included as neighbors.</para>
            /// <para>仅限毗连性边—共享边的面要素将作为邻居包括在内。</para>
            /// </summary>
            [Description("Contiguity edges only")]
            [GPEnumValue("CONTIGUITY_EDGES_ONLY")]
            _CONTIGUITY_EDGES_ONLY,

            /// <summary>
            /// <para>Contiguity edges corners</para>
            /// <para>Contiguity edges corners— Polygon features that share an edge or a corner will be included as neighbors. This is the default for polygon features.</para>
            /// <para>连续边角 - 共享边或角的面要素将作为邻居包括在内。这是面要素的默认设置。</para>
            /// </summary>
            [Description("Contiguity edges corners")]
            [GPEnumValue("CONTIGUITY_EDGES_CORNERS")]
            _CONTIGUITY_EDGES_CORNERS,

            /// <summary>
            /// <para>Delaunay triangulation</para>
            /// <para>Delaunay triangulation—Features whose Delaunay triangulation share an edge will be included as neighbors. This is the default for point features.</para>
            /// <para>Delaunay 三角剖分—Delaunay 三角剖分共享边的要素将作为相邻要素包括在内。这是点要素的默认设置。</para>
            /// </summary>
            [Description("Delaunay triangulation")]
            [GPEnumValue("DELAUNAY_TRIANGULATION")]
            _DELAUNAY_TRIANGULATION,

            /// <summary>
            /// <para>Get spatial weights from file</para>
            /// <para>Get spatial weights from file— Neighbors and weights will be defined by a specified spatial weights file.</para>
            /// <para>从文件中获取空间权重 - 相邻项和权重将由指定的空间权重文件定义。</para>
            /// </summary>
            [Description("Get spatial weights from file")]
            [GPEnumValue("GET_SPATIAL_WEIGHTS_FROM_FILE")]
            _GET_SPATIAL_WEIGHTS_FROM_FILE,

        }

        /// <summary>
        /// <para>Distance Band</para>
        /// <para>All features within this distance will be included as neighbors. If no value is provided, one will be estimated during execution and included as a geoprocessing message. If the specified distance results in more than 1,000 neighbors, only the closest 1,000 features will be included as neighbors.</para>
        /// <para>此距离内的所有要素都将作为邻居包括在内。如果未提供任何值，则将在执行过程中估计一个值，并将其作为地理处理消息包含在内。如果指定的距离导致超过 1,000 个邻居，则只有最接近的 1,000 个要素将作为邻居包括在内。</para>
        /// <para>单位： Feet | Meters | Kilometers | Miles </para>
        /// </summary>
        [DisplayName("Distance Band")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public string? _distance_band { get; set; } = null;


        /// <summary>
        /// <para>Number of Neighbors</para>
        /// <para>The number of neighbors that will be included for each local calculation. The number does not include the focal feature. If the focal feature is included in calculations, one additional neighbor will be used. The default is 8.</para>
        /// <para>每个局部计算将包含的邻居数。该数字不包括焦点特征。如果计算中包括焦点要素，则将使用一个额外的邻居。默认值为 8。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Number of Neighbors")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _number_of_neighbors { get; set; } = 8;


        /// <summary>
        /// <para>Weights Matrix File</para>
        /// <para>The path and file name of the spatial weights matrix file that defines spatial, and potentially temporal, relationships among features.</para>
        /// <para>空间权重矩阵文件的路径和文件名，用于定义要素之间的空间关系和潜在的时间关系。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Weights Matrix File")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _weights_matrix_file { get; set; } = null;


        /// <summary>
        /// <para>Local Weighting Scheme</para>
        /// <para><xdoc>
        ///   <para>Specifies the weighting scheme to apply to neighbors when calculating local statistics.</para>
        ///   <bulletList>
        ///     <bullet_item>Unweighted—Neighbors will not be weighted. This is the default.</bullet_item><para/>
        ///     <bullet_item>Bisquare—Neighbors will be weighted using a bisquare kernel scheme.</bullet_item><para/>
        ///     <bullet_item>Gaussian—Neighbors will be weighted using a Gaussian kernel scheme.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定在计算局部统计数据时应用于邻居的加权方案。</para>
        ///   <bulletList>
        ///     <bullet_item>未加权—不会对邻居进行加权。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>双方—将使用双方核方案对邻居进行加权。</bullet_item><para/>
        ///     <bullet_item>高斯—将使用高斯核方案对邻居进行加权。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Local Weighting Scheme")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _local_weighting_scheme_value _local_weighting_scheme { get; set; } = _local_weighting_scheme_value._UNWEIGHTED;

        public enum _local_weighting_scheme_value
        {
            /// <summary>
            /// <para>Unweighted</para>
            /// <para>Unweighted—Neighbors will not be weighted. This is the default.</para>
            /// <para>未加权—不会对邻居进行加权。这是默认设置。</para>
            /// </summary>
            [Description("Unweighted")]
            [GPEnumValue("UNWEIGHTED")]
            _UNWEIGHTED,

            /// <summary>
            /// <para>Bisquare</para>
            /// <para>Bisquare—Neighbors will be weighted using a bisquare kernel scheme.</para>
            /// <para>双方—将使用双方核方案对邻居进行加权。</para>
            /// </summary>
            [Description("Bisquare")]
            [GPEnumValue("BISQUARE")]
            _BISQUARE,

            /// <summary>
            /// <para>Gaussian</para>
            /// <para>Gaussian—Neighbors will be weighted using a Gaussian kernel scheme.</para>
            /// <para>高斯—将使用高斯核方案对邻居进行加权。</para>
            /// </summary>
            [Description("Gaussian")]
            [GPEnumValue("GAUSSIAN")]
            _GAUSSIAN,

        }

        /// <summary>
        /// <para>Kernel Bandwidth</para>
        /// <para>The bandwidth of the bisquare or Gaussian local weighting schemes. If no value is provided, one will be estimated during execution and included as a geoprocessing message.</para>
        /// <para>双平方或高斯局部加权方案的带宽。如果未提供任何值，则将在执行过程中估计一个值，并将其作为地理处理消息包含在内。</para>
        /// <para>单位： Feet | Meters | Kilometers | Miles </para>
        /// </summary>
        [DisplayName("Kernel Bandwidth")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public string? _kernel_bandwidth { get; set; } = null;


        public NeighborhoodSummaryStatistics SetEnv(object outputCoordinateSystem = null)
        {
            base.SetEnv(outputCoordinateSystem: outputCoordinateSystem);
            return this;
        }

    }

}